package com.ihg.hiex.entity.session.meeting;

import java.beans.Transient;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.time.DateUtils;

import com.demo2do.core.utils.DateFormatUtils;

/**
 * 会议创建模板
 * 
 * @author dan
 *
 */
@Entity
@Table(name = "session_meeting_template")
public class SessionMeetingTemplate {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 会议名称 */
    private String name;
    
    /** session的第几天 */
    private int day;
    
    /** 会议开始时间 HH:mm */
    private String startTime;
    
    /** 会议结束时间 HH:mm */
    private String endTime;
    
    /** 若owner为assessor group中assessor排位 */
    private String assessor;
    
    /** 若owner为assessor group中delegate排位 */
    private String delegate;
    
    /** 会议类型 */
    @Enumerated(EnumType.STRING)
    private Type type;
    
    /** 参与者类型 */
    @Enumerated(EnumType.STRING)
    private Target target;
    
    /** 是否是组会议 */
    @Column(name = "is_group")
    private boolean group;
    
    /** 房间类型 */
    @Enumerated(EnumType.STRING)
    private com.ihg.hiex.entity.data.conference.Type roomType;
    
    /** 是否是练习 */
    @Column(name = "is_exercise")
    private boolean exercise;
    
    @Column(name= "is_disabled")
    private boolean disabled;
    
    /**
     * The default construct
     */
    public SessionMeetingTemplate() {
    }
    
    /**
     * 
     * @param startDate
     * @return
     */
    @Transient
    public Date getStartDate(Date startDate) {
        Date date = com.demo2do.core.utils.DateUtils.parseDate(DateFormatUtils.format(DateUtils.addDays(startDate, day), "yyyy-MM-dd ") + startTime, "yyyy-MM-dd HH:mm");
        return date;
    }
    
    /**
     * @param startDate
     * @return
     */
    @Transient
    public Date getEndDate(Date startDate) {
        Date date = com.demo2do.core.utils.DateUtils.parseDate(DateFormatUtils.format(DateUtils.addDays(startDate, day), "yyyy-MM-dd ") + endTime, "yyyy-MM-dd HH:mm");
        return date;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the day
     */
    public int getDay() {
        return day;
    }

    /**
     * @return the startTime
     */
    public String getStartTime() {
        return startTime;
    }

    /**
     * @return the endTime
     */
    public String getEndTime() {
        return endTime;
    }

    /**
     * @return the assessor
     */
    public String getAssessor() {
        return assessor;
    }

    /**
     * @return the delegate
     */
    public String getDelegate() {
        return delegate;
    }

    /**
     * @return the type
     */
    public Type getType() {
        return type;
    }

    /**
     * @return the target
     */
    public Target getTarget() {
        return target;
    }

    /**
     * @return the group
     */
    public boolean isGroup() {
        return group;
    }

    /**
     * @return the roomType
     */
    public com.ihg.hiex.entity.data.conference.Type getRoomType() {
        return roomType;
    }

    /**
     * @return the exercise
     */
    public boolean isExercise() {
        return exercise;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param day the day to set
     */
    public void setDay(int day) {
        this.day = day;
    }

    /**
     * @param startTime the startTime to set
     */
    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    /**
     * @param endTime the endTime to set
     */
    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    /**
     * @param assessor the assessor to set
     */
    public void setAssessor(String assessor) {
        this.assessor = assessor;
    }

    /**
     * @param delegate the delegate to set
     */
    public void setDelegate(String delegate) {
        this.delegate = delegate;
    }

    /**
     * @param type the type to set
     */
    public void setType(Type type) {
        this.type = type;
    }

    /**
     * @param target the target to set
     */
    public void setTarget(Target target) {
        this.target = target;
    }

    /**
     * @param group the group to set
     */
    public void setGroup(boolean group) {
        this.group = group;
    }

    /**
     * @param roomType the roomType to set
     */
    public void setRoomType(com.ihg.hiex.entity.data.conference.Type roomType) {
        this.roomType = roomType;
    }

    /**
     * @param exercise the exercise to set
     */
    public void setExercise(boolean exercise) {
        this.exercise = exercise;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

}
